import React, {Component} from 'react'
import {MainTabWrapper} from "./styled";
import {connect} from 'react-redux'
import {actionFunc} from './store'
import history from '@/history'
class MainTab extends Component {
    render() {
        const {location} = this.props
        return (
            <MainTabWrapper>
                <div className='location'>{location}</div>
            </MainTabWrapper>
        )
    }
    componentWillMount(){
        this.props.changeLocation()
    }
}
const mapState = (state)=>({
    location: state.getIn(['mainTab','location']),
})
const mapDispatch = (dispatch)=>({
    changeLocation(){
        dispatch(actionFunc.getLocation(history.location.pathname))
    }
})

export default connect(mapState, mapDispatch)(MainTab)
